//package com.erik.lin.activemq.consumer;
//
///**
// * Created by Erik on 2017/4/26.
// */
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.jms.core.JmsTemplate;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import javax.jms.Destination;
//import javax.jms.JMSException;
//import javax.jms.TextMessage;
//
//
//@Service
//public class QueueConsumerService {//只用来主动接收队列queue的消息，topic订阅没有主动接收功能
//
//    private static Logger LOG = LoggerFactory.getLogger(QueueConsumerService.class);
//
//    @Resource(name = "jmsQueueTemplate")
//    private JmsTemplate jmsQueueTemplate;
//
//    /**
//     * 接收消息
//     */
//    public TextMessage receive(Destination destination) {
//        TextMessage tm = (TextMessage) jmsQueueTemplate.receive(destination);
//        try {
//            LOG.info("从队列 {} 收到了消息: {}", destination.toString(), tm.getText());
//        } catch (JMSException e) {
//            e.printStackTrace();
//        }
//
//        return tm;
//
//    }
//
//}
